#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
FCA=$GOPATH/src/github.com/hyperledger/fabric-ca

echo "Running all tests ..."
{
export PATH=$PATH:$GOPATH/bin

go get github.com/axw/gocov/...
go get github.com/AlekSi/gocov-xml

PKGS=`go list github.com/hyperledger/fabric-ca/... | grep -Ev '/vendor/|/api|/dbutil|/ldap|/mocks|/test/fabric-ca-load-tester'`

gocov test -timeout 15m $PKGS | gocov-xml > coverage.xml

} 2>&1 | tee /tmp/test.results
echo "Finished running all tests"

$FCA/scripts/check_test_results /tmp/test.results

exit $?
